module exu
(
    input   wire                exu_instr_branch_i,
    input   wire                exu_branch_predic_res_i,
    input   wire    [02:00]     exu_funct3_i,
    input   wire    [03:00]     exu_disp_target_i,
    input   wire    [10:00]     exu_alu_op_i,
    input   wire    [01:00]     exu_alu_shift_mode_i,
    input   wire    [08:00]     exu_mdu_op_i,
    input   wire    [63:00]     exu_shift2_i,
    input   wire    [32:00]     exu_add_res_l_i  ,
    input   wire    [31:00]     exu_add_res_h_i  ,
    input   wire    [32:00]     exu_sub_res_l_i  ,   
    input   wire    [31:00]     exu_sub_res_h_i  ,
    input   wire                exu_subu_res_l_i ,
    input   wire    [31:00]     exu_subu_res_h_i ,

    input   wire    [63:00]     exu_operand1_i,
    input   wire    [63:00]     exu_operand2_i,
    input   wire    [63:00]     exu_csr_data_i,

    output 	wire 				exu_branch_predic_fault_o,
    output  wire    [63:00]     exu_mdu_output_o,
    output  wire    [63:00]     exu_alu_output_o,
    output  wire    [63:00]     exu_csr_write_back_data_o
);
// -------------------------------------wires------------------------------------------------
    //  alu
    wire    [63:00]     alu_output;
    //  cgu
    wire                disp_cgu                    =   exu_disp_target_i[01];

// --------------------------------------------------------------------------------------------
// --------------------------------------------instance------------------------------------
    //
    alu                                                                     alu 
    (
        .funct3                                                             (exu_funct3_i),
        .shift2                                                             (exu_shift2_i),
        .add_res_l                                                          (exu_add_res_l_i ) ,
        .add_res_h                                                          (exu_add_res_h_i ) ,
        .sub_res_l                                                          (exu_sub_res_l_i ) ,
        .sub_res_h                                                          (exu_sub_res_h_i ) ,
        .subu_res_l                                                         (exu_subu_res_l_i) ,
        .subu_res_h                                                         (exu_subu_res_h_i) ,
	    .operand1                                                           (exu_operand1_i),
	    .operand2                                                           (exu_operand2_i),
        .instr_branch                                                       (exu_instr_branch_i),
	    .branch_predic_res                                                  (exu_branch_predic_res_i),
	    .alu_op                                                             (exu_alu_op_i),
	    .alu_shift_mode                                                     (exu_alu_shift_mode_i),
        .branch_predic_fault                                                (exu_branch_predic_fault_o),
	    .alu_output                                                         (alu_output) 
    );
    //
    cgu                                                                     cgu
    (
        .disp_cgu                                                           (disp_cgu),
        .operand1                                                           (exu_operand1_i),          
        .operand2                                                           (exu_operand2_i),
        .csr_data                                                           (exu_csr_data_i),
        .funct3                                                             (exu_funct3_i),
        .csr_write_back_data                                                (exu_csr_write_back_data_o)
    );
    //
    assign  exu_mdu_output_o    =   64'b0;
    // ----------------------------------------------------------------------------------------------
    //  单周期可完成的指令都派遣为ALU执行，因此Zicsr需要归到ALU数据通路中
    assign  exu_alu_output_o    =   alu_output | exu_csr_data_i;
endmodule